package com.blame.onlinemusicserver.controller;

import com.blame.onlinemusicserver.model.Music;
import com.blame.onlinemusicserver.model.User;
import com.blame.onlinemusicserver.service.LoveMusicService;
import com.blame.onlinemusicserver.tools.ResponseBodyMessage;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/lovemusic")
public class LoveMusicController {

    @Autowired
    private LoveMusicService loveMusicService;

    @RequestMapping("addLikeMusic")
    public ResponseBodyMessage<Boolean> addLikeMusic(@RequestParam String id,HttpServletRequest request){
        return loveMusicService.addLikeMusic(id,request);
    }

    @RequestMapping("deleteLikeMusic")
    public ResponseBodyMessage<Boolean> deleteLikeMusic(@RequestParam String id,HttpServletRequest request){
        return loveMusicService.deleteLikeMusic(id,request);
    }

    @RequestMapping("/findlovemusic")
    public ResponseBodyMessage<List<Music>> findLoveMusic(HttpServletRequest request,@RequestParam(required = false)
                                                          String musicName){
        return loveMusicService.findLoveMusic(request, musicName);
    }
}
